package com.wsd.smartcarwasher.service;

import com.wsd.smartcarwasher.dao.MachineDao;
import com.wsd.smartcarwasher.dao.OrderDao;
import com.wsd.smartcarwasher.dao.PartnerDao;
import com.wsd.smartcarwasher.dao.ProrateMapper;
import com.wsd.smartcarwasher.domain.Machine;
import com.wsd.smartcarwasher.domain.OrderInfo;
import com.wsd.smartcarwasher.domain.Partner;
import com.wsd.smartcarwasher.domain.Prorate;
import com.wsd.smartcarwasher.util.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class ProrateService {


    @Resource
    private OrderDao orderDao;


    @Resource
    private PartnerDao partnerDao;

    @Resource
    private MachineDao MachineDao;

    @Resource
    private ProrateMapper prorateMapper;


    public List<OrderInfo> queryAllOrdersByCashWithdrawal() {
        return  orderDao.queryAllOrdersByCashWithdrawal();
    }

    public Machine queryMachineById(Integer k) {
        return MachineDao.queryMachineById(k);
    }

    public void cashWithdrawalSuccess(List<OrderInfo> orderInfoList) {
        orderDao.cashWithdrawalSuccess(orderInfoList);
    }

    public void cashWithdrawalFail(List<OrderInfo> orderInfoList) {
        orderDao.cashWithdrawalFail(orderInfoList);
    }

    public int insertSelective(Prorate prorate) {
        return prorateMapper.insert(prorate);
    }

    public Partner getPartnerById(int partnerId) {

        return partnerDao.getPartnerById(partnerId);
    }

    public List<Prorate> getAll(Prorate prorate) {


        return prorateMapper.selectAll(prorate);
    }

    public int update(Prorate prorate) {
        return prorateMapper.update(prorate);
    }

    public Prorate queryById(String prorateSn) {
        return prorateMapper.queryById(prorateSn);
    }
}
